<template>
  <div style="width:1280px; margin: 0 auto">
    <el-steps :active="active" finish-status="success">
      <el-step title="步骤 1"></el-step>
      <el-step title="步骤 2"></el-step>
      <el-step title="步骤 3"></el-step>
    </el-steps>
    <One @oneData="receive" v-show="this.active ===1"></One>
    <Two @oneData2="receive2" v-show="this.active ===2"></Two>
    <San v-show="this.active ===3"></San>
    <el-button style="margin-top: 12px;" :disabled="dis1" @click="next">{{buttonTexts}}</el-button>
    <el-button style="margin-top: 12px;" :disabled="dis2" @click="last">上一步</el-button>
  </div>
</template>

<script>
import One from "../ReleaseGame/One"
import Two from "../ReleaseGame/Two";
import San from "../ReleaseGame/San";
export default {
  name: "ReleaseMain",
  data() {
    return{
      active: 1,
      dis1:false,
      dis2:true,
      buttonTexts:'下一步',
      firstData:[],
      secondData:[],
      onesdatas: {},
      tow2:'',
    }
  },
  methods: {
    next() {

      if (this.active===1) {
        //  这里是第一步数据验证   成功则下一步
        this.dis2=true;
        // if (this.onesdatas.delivery) {
        //   console.log('验证成功')
        //   this.active++;
        //   this.dis2=false;
        // } else {
        //   console.log('验证不成功')
        //
        // }    //暂时注释
        this.active++;
        this.dis2=false;
        console.log('现在下标为',this.active);
        console.log('这里是第一步验证')
        return;   //成功了就不再执行下面的  不然active变成2的时候还会执行
      }

      if (this.active === 2) {
        if (this.tow2 === '') {
          console.log('验证不成功2')
        } else {
          this.active++;
          this.buttonTexts ='提交'
        }
        return;
      }

      if (this.active=== 3){


      }
    },
    last(){
      this.active--;
      this.buttonTexts ='下一步'
      if (this.active===1){
        this.dis2=true;
      }
    }
    ,
    receive(value){
      console.log(value);
      this.onesdatas =value;
    },
    receive2(v){
      console.log(v);
      this.tow2=v;
    }

  },
  components:{
    One,
    Two,
    San,
  }
}
</script>

<style scoped>

</style>
